import { createRouter, createWebHistory } from 'vue-router'
import MyLogin from '../views/login/MyLogin.vue'
import HomeIndex from '../views/HomeIndex.vue'

import EchartsView from '../views/HomeChild/EchartsView.vue'
import PermissionList from '../views/HomeChild/PermissionList.vue'
import UserList from '../views/HomeChild/UserList.vue'
import UserMessage from '../views/HomeChild/UserMessage.vue'
import UserUpdate from '../views/HomeChild/UserUpdate.vue'




const routes = [
  {
    path: "/",
    redirect: "/login"
  },
  {
    path: '/login',
    name: 'login',
    component: MyLogin
  },
  {
    path: '/home',
    name: 'home',
    component: HomeIndex,
    children: [
      {
        path: '/echarts',
        name: 'echarts',
        component: EchartsView,
        meta: {
          title: "数据展示"
        }
      },
      {
        path: '/permissionlist',
        name: 'permissionlist',
        component: PermissionList,
        meta: {
          title: "权限列表"
        }
      },
      {
        path: "/user",
        name: "user",
        component: UserList,
        redirect: "/UserList",
        meta: {
          title: "住户信息"
        },
        children: [
          {
            path: '/usermessage',
            name: 'usermessage',
            component: UserMessage,
            meta: {
              classifyTitle: "用户信息",//分类标题
              title: "住户列表"
            }
          },
          {
            path: '/userupdate',
            name: 'userupdate',
            component: UserUpdate,
            meta: {
              classifyTitle: "用户信息",//分类标题
              title: "住户信息修改"
            }
          },
        ]
      }
    ]
  },
]
const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

export default router
